package com.gs.api.config;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author guoyunfei on 2021/7/18 13:55
 * @className SwaggerConfig
 * @description TODO Swagger 接口API生成
 * @Version 1.0
 */
//@Profile({"pro","test","dev"})
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
class SwaggerConfig {

    @Bean
    public Docket baseRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("基础版")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.gs.api"))
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("壁纸小程序接口文档")
                .description("壁纸小程序接口文档Swagger版  Rest API接口")
                .termsOfServiceUrl("http://localhost:8081/apiv2")
                .contact(new Contact("MrGuo", "http://localhost:8081/apiv2", "2549789059@qq.com"))
                .version("1.0")
                .build();
    }



}
